{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from icepyx import icesat2data as ipd\n",
    "import os\n",
    "import shutil\n",
    "from pathlib import Path\n",
    "from pprint import pprint\n",
    "\n",
    "import pandas as pd\n",
    "\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Download ATL06 data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "short_name = 'ATL06'\n",
    "spatial_extent = [ -50.71,  65.73, -45.32,  68.08]\n",
    "date_range = ['2019-06-01','2019-06-05']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ATL06\n",
      "['2019-06-01', '2019-06-05']\n",
      "00:00:00\n",
      "23:59:59\n",
      "003\n",
      "['bounding box', [-50.71, 65.73, -45.32, 68.08]]\n"
     ]
    }
   ],
   "source": [
    "region_a = ipd.Icesat2Data(short_name, spatial_extent, date_range)\n",
    "\n",
    "print(region_a.dataset)\n",
    "print(region_a.dates)\n",
    "print(region_a.start_time)\n",
    "print(region_a.end_time)\n",
    "print(region_a.dataset_version)\n",
    "print(region_a.spatial_extent)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['ATL06_20190601071608_09780303_003_01.h5',\n",
       " 'ATL06_20190601200102_09860305_003_01.h5',\n",
       " 'ATL06_20190605070748_10390303_003_01.h5',\n",
       " 'ATL06_20190605195242_10470305_003_01.h5']"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "region_a.avail_granules(ids=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "Earthdata Login password:  ········\n"
     ]
    }
   ],
   "source": [
    "earthdata_emails = {'tsnow03':'tasha.snow@colorado.edu',\n",
    "                 'fperez': 'fernando.perez@berkeley.edu',\n",
    "                 'alicecima':'alice_cima@berkeley.edu',\n",
    "                 'grigsbye':'grigsby@mines.edu'\n",
    "                    # add your name here\n",
    "                }\n",
    "\n",
    "user = 'grigsbye'\n",
    "region_a.earthdata_login(user, earthdata_emails[user])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "var_list inputs: atlas_sdp_gps_epoch, control, data_end_utc, data_start_utc, end_cycle, end_delta_time, end_geoseg, end_gpssow, end_gpsweek, end_orbit, end_region, end_rgt, granule_end_utc, granule_start_utc, qa_at_interval, release, start_cycle, start_delta_time, start_geoseg, start_gpssow, start_gpsweek, start_orbit, start_region, start_rgt, version, dt_hist, fit_maxiter, fpb_maxiter, maxiter, max_res_ids, min_dist, min_gain_th, min_n_pe, min_n_sel, min_signal_conf, n_hist, nhist_bins, n_sigmas, proc_interval, qs_lim_bsc, qs_lim_hrs, qs_lim_hsigma, qs_lim_msw, qs_lim_snr, qs_lim_sss, rbin_width, sigma_beam, sigma_tx, t_dead, atl06_quality_summary, delta_time, h_li, h_li_sigma, latitude, longitude, segment_id, sigma_geo_h, fpb_mean_corr, fpb_mean_corr_sigma, fpb_med_corr, fpb_med_corr_sigma, fpb_n_corr, med_r_fit, tx_mean_corr, tx_med_corr, dem_flag, dem_h, geoid_h, dh_fit_dx, dh_fit_dx_sigma, dh_fit_dy, h_expected_rms, h_mean, h_rms_misfit, h_robust_sprd, n_fit_photons, n_seg_pulses, sigma_h_mean, signal_selection_source, signal_selection_source_status, snr, snr_significance, w_surface_window_final, bckgrd, bsnow_conf, bsnow_h, bsnow_od, cloud_flg_asr, cloud_flg_atm, dac, e_bckgrd, layer_flag, msw_flag, neutat_delay_total, r_eff, solar_azimuth, solar_elevation, tide_earth, tide_equilibrium, tide_load, tide_ocean, tide_pole, ref_azimuth, ref_coelv, seg_azimuth, sigma_geo_at, sigma_geo_r, sigma_geo_xt, x_atc, y_atc, bckgrd_per_m, bin_top_h, count, ds_segment_id, lat_mean, lon_mean, pulse_count, segment_id_list, x_atc_mean, record_number, reference_pt_lat, reference_pt_lon, signal_selection_status_all, signal_selection_status_backup, signal_selection_status_confident, crossing_time, cycle_number, lan, orbit_number, rgt, sc_orient, sc_orient_time, qa_granule_fail_reason, qa_granule_pass_fail, signal_selection_source_fraction_0, signal_selection_source_fraction_1, signal_selection_source_fraction_2, signal_selection_source_fraction_3\n",
      "keyword_list and beam_list inputs: ancillary_data, bias_correction, dem, fit_statistics, geophysical, ground_track, gt1l, gt1r, gt2l, gt2r, gt3l, gt3r, land_ice, land_ice_segments, none, orbit_info, quality_assessment, residual_histogram, segment_quality, signal_selection_status\n"
     ]
    }
   ],
   "source": [
    "# All possible variables\n",
    "region_a.order_vars.avail(options=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Choose variables to order\n",
    "# region_a.order_vars.remove(all=True)\n",
    "#region_a.order_vars.append(defaults=True)\n",
    "#from IPython.display import JSON\n",
    "#JSON(region_a.order_vars.wanted)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/json": {
       "atl06_quality_summary": [
        "gt1l/land_ice_segments/atl06_quality_summary",
        "gt1r/land_ice_segments/atl06_quality_summary",
        "gt2l/land_ice_segments/atl06_quality_summary",
        "gt2r/land_ice_segments/atl06_quality_summary",
        "gt3l/land_ice_segments/atl06_quality_summary",
        "gt3r/land_ice_segments/atl06_quality_summary"
       ],
       "atlas_sdp_gps_epoch": [
        "ancillary_data/atlas_sdp_gps_epoch"
       ],
       "bckgrd": [
        "gt1l/land_ice_segments/geophysical/bckgrd",
        "gt1r/land_ice_segments/geophysical/bckgrd",
        "gt2l/land_ice_segments/geophysical/bckgrd",
        "gt2r/land_ice_segments/geophysical/bckgrd",
        "gt3l/land_ice_segments/geophysical/bckgrd",
        "gt3r/land_ice_segments/geophysical/bckgrd"
       ],
       "bsnow_conf": [
        "gt1l/land_ice_segments/geophysical/bsnow_conf",
        "gt1r/land_ice_segments/geophysical/bsnow_conf",
        "gt2l/land_ice_segments/geophysical/bsnow_conf",
        "gt2r/land_ice_segments/geophysical/bsnow_conf",
        "gt3l/land_ice_segments/geophysical/bsnow_conf",
        "gt3r/land_ice_segments/geophysical/bsnow_conf"
       ],
       "bsnow_h": [
        "gt1l/land_ice_segments/geophysical/bsnow_h",
        "gt1r/land_ice_segments/geophysical/bsnow_h",
        "gt2l/land_ice_segments/geophysical/bsnow_h",
        "gt2r/land_ice_segments/geophysical/bsnow_h",
        "gt3l/land_ice_segments/geophysical/bsnow_h",
        "gt3r/land_ice_segments/geophysical/bsnow_h"
       ],
       "bsnow_od": [
        "gt1l/land_ice_segments/geophysical/bsnow_od",
        "gt1r/land_ice_segments/geophysical/bsnow_od",
        "gt2l/land_ice_segments/geophysical/bsnow_od",
        "gt2r/land_ice_segments/geophysical/bsnow_od",
        "gt3l/land_ice_segments/geophysical/bsnow_od",
        "gt3r/land_ice_segments/geophysical/bsnow_od"
       ],
       "cloud_flg_asr": [
        "gt1l/land_ice_segments/geophysical/cloud_flg_asr",
        "gt1r/land_ice_segments/geophysical/cloud_flg_asr",
        "gt2l/land_ice_segments/geophysical/cloud_flg_asr",
        "gt2r/land_ice_segments/geophysical/cloud_flg_asr",
        "gt3l/land_ice_segments/geophysical/cloud_flg_asr",
        "gt3r/land_ice_segments/geophysical/cloud_flg_asr"
       ],
       "cloud_flg_atm": [
        "gt1l/land_ice_segments/geophysical/cloud_flg_atm",
        "gt1r/land_ice_segments/geophysical/cloud_flg_atm",
        "gt2l/land_ice_segments/geophysical/cloud_flg_atm",
        "gt2r/land_ice_segments/geophysical/cloud_flg_atm",
        "gt3l/land_ice_segments/geophysical/cloud_flg_atm",
        "gt3r/land_ice_segments/geophysical/cloud_flg_atm"
       ],
       "data_end_utc": [
        "ancillary_data/data_end_utc"
       ],
       "data_start_utc": [
        "ancillary_data/data_start_utc"
       ],
       "dh_fit_dx": [
        "gt1l/land_ice_segments/fit_statistics/dh_fit_dx",
        "gt1r/land_ice_segments/fit_statistics/dh_fit_dx",
        "gt2l/land_ice_segments/fit_statistics/dh_fit_dx",
        "gt2r/land_ice_segments/fit_statistics/dh_fit_dx",
        "gt3l/land_ice_segments/fit_statistics/dh_fit_dx",
        "gt3r/land_ice_segments/fit_statistics/dh_fit_dx"
       ],
       "e_bckgrd": [
        "gt1l/land_ice_segments/geophysical/e_bckgrd",
        "gt1r/land_ice_segments/geophysical/e_bckgrd",
        "gt2l/land_ice_segments/geophysical/e_bckgrd",
        "gt2r/land_ice_segments/geophysical/e_bckgrd",
        "gt3l/land_ice_segments/geophysical/e_bckgrd",
        "gt3r/land_ice_segments/geophysical/e_bckgrd"
       ],
       "end_delta_time": [
        "ancillary_data/end_delta_time"
       ],
       "end_geoseg": [
        "ancillary_data/end_geoseg"
       ],
       "granule_end_utc": [
        "ancillary_data/granule_end_utc"
       ],
       "granule_start_utc": [
        "ancillary_data/granule_start_utc"
       ],
       "h_li": [
        "gt1l/land_ice_segments/h_li",
        "gt1r/land_ice_segments/h_li",
        "gt2l/land_ice_segments/h_li",
        "gt2r/land_ice_segments/h_li",
        "gt3l/land_ice_segments/h_li",
        "gt3r/land_ice_segments/h_li"
       ],
       "h_li_sigma": [
        "gt1l/land_ice_segments/h_li_sigma",
        "gt1r/land_ice_segments/h_li_sigma",
        "gt2l/land_ice_segments/h_li_sigma",
        "gt2r/land_ice_segments/h_li_sigma",
        "gt3l/land_ice_segments/h_li_sigma",
        "gt3r/land_ice_segments/h_li_sigma"
       ],
       "h_robust_sprd": [
        "gt1l/land_ice_segments/fit_statistics/h_robust_sprd",
        "gt1r/land_ice_segments/fit_statistics/h_robust_sprd",
        "gt2l/land_ice_segments/fit_statistics/h_robust_sprd",
        "gt2r/land_ice_segments/fit_statistics/h_robust_sprd",
        "gt3l/land_ice_segments/fit_statistics/h_robust_sprd",
        "gt3r/land_ice_segments/fit_statistics/h_robust_sprd"
       ],
       "latitude": [
        "gt1l/land_ice_segments/latitude",
        "gt1r/land_ice_segments/latitude",
        "gt2l/land_ice_segments/latitude",
        "gt2r/land_ice_segments/latitude",
        "gt3l/land_ice_segments/latitude",
        "gt3r/land_ice_segments/latitude"
       ],
       "layer_flag": [
        "gt1l/land_ice_segments/geophysical/layer_flag",
        "gt1r/land_ice_segments/geophysical/layer_flag",
        "gt2l/land_ice_segments/geophysical/layer_flag",
        "gt2r/land_ice_segments/geophysical/layer_flag",
        "gt3l/land_ice_segments/geophysical/layer_flag",
        "gt3r/land_ice_segments/geophysical/layer_flag"
       ],
       "longitude": [
        "gt1l/land_ice_segments/longitude",
        "gt1r/land_ice_segments/longitude",
        "gt2l/land_ice_segments/longitude",
        "gt2r/land_ice_segments/longitude",
        "gt3l/land_ice_segments/longitude",
        "gt3r/land_ice_segments/longitude"
       ],
       "msw_flag": [
        "gt1l/land_ice_segments/geophysical/msw_flag",
        "gt1r/land_ice_segments/geophysical/msw_flag",
        "gt2l/land_ice_segments/geophysical/msw_flag",
        "gt2r/land_ice_segments/geophysical/msw_flag",
        "gt3l/land_ice_segments/geophysical/msw_flag",
        "gt3r/land_ice_segments/geophysical/msw_flag"
       ],
       "n_fit_photons": [
        "gt1l/land_ice_segments/fit_statistics/n_fit_photons",
        "gt1r/land_ice_segments/fit_statistics/n_fit_photons",
        "gt2l/land_ice_segments/fit_statistics/n_fit_photons",
        "gt2r/land_ice_segments/fit_statistics/n_fit_photons",
        "gt3l/land_ice_segments/fit_statistics/n_fit_photons",
        "gt3r/land_ice_segments/fit_statistics/n_fit_photons"
       ],
       "sc_orient": [
        "orbit_info/sc_orient"
       ],
       "sc_orient_time": [
        "orbit_info/sc_orient_time"
       ],
       "segment_id": [
        "gt1l/land_ice_segments/segment_id",
        "gt1l/segment_quality/segment_id",
        "gt1r/land_ice_segments/segment_id",
        "gt1r/segment_quality/segment_id",
        "gt2l/land_ice_segments/segment_id",
        "gt2l/segment_quality/segment_id",
        "gt2r/land_ice_segments/segment_id",
        "gt2r/segment_quality/segment_id",
        "gt3l/land_ice_segments/segment_id",
        "gt3l/segment_quality/segment_id",
        "gt3r/land_ice_segments/segment_id",
        "gt3r/segment_quality/segment_id"
       ],
       "signal_selection_source": [
        "gt1l/land_ice_segments/fit_statistics/signal_selection_source",
        "gt1l/segment_quality/signal_selection_source",
        "gt1r/land_ice_segments/fit_statistics/signal_selection_source",
        "gt1r/segment_quality/signal_selection_source",
        "gt2l/land_ice_segments/fit_statistics/signal_selection_source",
        "gt2l/segment_quality/signal_selection_source",
        "gt2r/land_ice_segments/fit_statistics/signal_selection_source",
        "gt2r/segment_quality/signal_selection_source",
        "gt3l/land_ice_segments/fit_statistics/signal_selection_source",
        "gt3l/segment_quality/signal_selection_source",
        "gt3r/land_ice_segments/fit_statistics/signal_selection_source",
        "gt3r/segment_quality/signal_selection_source"
       ],
       "snr_significance": [
        "gt1l/land_ice_segments/fit_statistics/snr_significance",
        "gt1r/land_ice_segments/fit_statistics/snr_significance",
        "gt2l/land_ice_segments/fit_statistics/snr_significance",
        "gt2r/land_ice_segments/fit_statistics/snr_significance",
        "gt3l/land_ice_segments/fit_statistics/snr_significance",
        "gt3r/land_ice_segments/fit_statistics/snr_significance"
       ],
       "start_delta_time": [
        "ancillary_data/start_delta_time"
       ],
       "w_surface_window_final": [
        "gt1l/land_ice_segments/fit_statistics/w_surface_window_final",
        "gt1r/land_ice_segments/fit_statistics/w_surface_window_final",
        "gt2l/land_ice_segments/fit_statistics/w_surface_window_final",
        "gt2r/land_ice_segments/fit_statistics/w_surface_window_final",
        "gt3l/land_ice_segments/fit_statistics/w_surface_window_final",
        "gt3r/land_ice_segments/fit_statistics/w_surface_window_final"
       ]
      },
      "text/plain": [
       "<IPython.core.display.JSON object>"
      ]
     },
     "execution_count": 10,
     "metadata": {
      "application/json": {
       "expanded": false,
       "root": "root"
      }
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "region_a.order_vars.append(var_list=['latitude','longitude','h_li','h_li_sigma','atl06_quality_summary',\n",
    "                                      'signal_selection_source','snr_significance','h_robust_sprd','dh_fit_dx','bsnow_conf',\n",
    "                                      'cloud_flg_asr','cloud_flg_atm','msw_flag','bsnow_h','bsnow_od','layer_flag','bckgrd',\n",
    "                                      'e_bckgrd','n_fit_photons','end_geoseg','segment_id','w_surface_window_final'])\n",
    "from IPython.display import JSON\n",
    "JSON(region_a.order_vars.wanted)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now, specify our coverage request with the wanted variables:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "region_a.subsetparams(Coverage=region_a.order_vars.wanted);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total number of data order requests is  1  for  4  granules.\n",
      "Data request  1  of  1  is submitting to NSIDC\n",
      "order ID:  5000000701107\n",
      "Initial status of your order request at NSIDC is:  processing\n",
      "Your order status is still  processing  at NSIDC. Please continue waiting... this may take a few moments.\n",
      "Your order is: complete\n"
     ]
    }
   ],
   "source": [
    "region_a.order_granules()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['5000000701107']"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# View a short list of order IDs:\n",
    "region_a.granules.orderIDs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Beginning download of zipped output...\n",
      "Data request 5000000701107 of  1  order(s) is downloaded.\n",
      "Download complete\n"
     ]
    }
   ],
   "source": [
    "path = './download'\n",
    "# without variable subsetting, or with variable subsetting if you have run region_a.order_granules(Coverage=region_a.order_vars.wanted)\n",
    "region_a.download_granules(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9.5M\t./download\n",
      "9.5M\ttotal\n"
     ]
    }
   ],
   "source": [
    "!du -csh ./download"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Build Pandas DataFrame"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Some utility functions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pyproj\n",
    "from astropy.time import Time\n",
    "\n",
    "def gps2dyr(time):\n",
    "    \"\"\"Converte GPS time to decimal years.\"\"\"\n",
    "    return Time(time, format='gps').decimalyear\n",
    "\n",
    "\n",
    "def orbit_type(time, lat, tmax=1):\n",
    "    \"\"\"Separate tracks into ascending and descending.\n",
    "    \n",
    "    Defines tracks as segments with time breaks > tmax,\n",
    "    and tests whether lat increases or decreases w/time.\n",
    "    \"\"\"\n",
    "    tracks = np.zeros(lat.shape)  # generate track segment\n",
    "    tracks[0:np.argmax(np.abs(lat))] = 1  # set values for segment\n",
    "    is_asc = np.zeros(tracks.shape, dtype=bool)  # output index array\n",
    "\n",
    "    # Loop trough individual secments\n",
    "    for track in np.unique(tracks):\n",
    "    \n",
    "        i_track, = np.where(track == tracks)  # get all pts from seg\n",
    "    \n",
    "        if len(i_track) < 2: continue\n",
    "    \n",
    "        # Test if lat increases (asc) or decreases (des) w/time\n",
    "        i_min = time[i_track].argmin()\n",
    "        i_max = time[i_track].argmax()\n",
    "        lat_diff = lat[i_track][i_max] - lat[i_track][i_min]\n",
    "    \n",
    "        # Determine track type\n",
    "        if lat_diff > 0:  is_asc[i_track] = True\n",
    "    \n",
    "    return is_asc\n",
    "\n",
    "\n",
    "def transform_coord(proj1, proj2, x, y):\n",
    "    \"\"\"Transform coordinates from proj1 to proj2 (EPSG num).\n",
    "\n",
    "    Example EPSG projections:\n",
    "        Geodetic (lon/lat): 4326\n",
    "        Polar Stereo AnIS (x/y): 3031\n",
    "        Polar Stereo GrIS (x/y): 3413\n",
    "    \"\"\"\n",
    "    # Set full EPSG projection strings\n",
    "    proj1 = pyproj.Proj(\"+init=EPSG:\"+str(proj1))\n",
    "    proj2 = pyproj.Proj(\"+init=EPSG:\"+str(proj2))\n",
    "    return pyproj.transform(proj1, proj2, x, y)  # convert\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "import h5py\n",
    "import numpy as np\n",
    "\n",
    "def read_atl06(fname, outdir='data', bbox=None):\n",
    "    \"\"\"Read one ATL06 file and output 6 reduced files. \n",
    "    \n",
    "    Extract variables of interest and separate the ATL06 file \n",
    "    into each beam (ground track) and ascending/descending orbits.\n",
    "    \"\"\"\n",
    "\n",
    "    # Each beam is a group\n",
    "    group = ['/gt1l', '/gt1r', '/gt2l', '/gt2r', '/gt3l', '/gt3r']\n",
    "    \n",
    "    # Loop trough beams\n",
    "    dataframes = []  # one dataframe per track\n",
    "    \n",
    "    with h5py.File(fname, 'r') as fi:\n",
    "        # Check which ground tracks are present in this file\n",
    "        gtracks = sorted(['/'+k for k in fi.keys() if k.startswith('gt')])\n",
    "        print('Available ground tracks:', gtracks)\n",
    "    \n",
    "        for k, g in enumerate(gtracks): \n",
    "            # Read in data for a single beam\n",
    "            data = {}\n",
    "            data['ground_track'] = None # Put it first in the dict for column ordering\n",
    "    \n",
    "            # Load vars into memory (include as many as you want)\n",
    "            data['lat'] = fi[g+'/land_ice_segments/latitude'][:]\n",
    "            data['lon'] = fi[g+'/land_ice_segments/longitude'][:]\n",
    "            data['h_li'] = fi[g+'/land_ice_segments/h_li'][:]\n",
    "            data['s_li'] = fi[g+'/land_ice_segments/h_li_sigma'][:]\n",
    "            data['q_flag'] = fi[g+'/land_ice_segments/atl06_quality_summary'][:]\n",
    "            data['s_fg'] = fi[g+'/land_ice_segments/fit_statistics/signal_selection_source'][:]\n",
    "            data['snr'] = fi[g+'/land_ice_segments/fit_statistics/snr_significance'][:]\n",
    "            data['h_rb'] = fi[g+'/land_ice_segments/fit_statistics/h_robust_sprd'][:]\n",
    "            data['dh_fit_dx'] = fi[g+'/land_ice_segments/fit_statistics/dh_fit_dx'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/geophysical/bsnow_conf'][:]\n",
    "            \n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/geophysical/cloud_flg_asr'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/geophysical/cloud_flg_atm'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/geophysical/msw_flag'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/geophysical/bsnow_h'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/geophysical/bsnow_od'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/geophysical/layer_flag'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/geophysical/bckgrd'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/geophysical/e_bckgrd'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/fit_statistics/n_fit_photons'][:]\n",
    "            data['f_sn'] = fi['/ancillary_data/end_geoseg'][:]\n",
    "            data['f_sn'] = fi[g+'/segment_quality/segment_id'][:]\n",
    "            data['f_sn'] = fi[g+'/land_ice_segments/fit_statistics/w_surface_window_final'][:]\n",
    "\n",
    "            '''\n",
    "            ***Continue adding columns for these vars, repeated as above. Need to find group/file \n",
    "               structure for each in https://nsidc.org/sites/nsidc.org/files/technical-references/ICESat2_ATL06_data_dict_v003.pdf):\n",
    "               cloud_flg_asr, cloud_flg_atm, msw_flag, bsnow_h, bsnow_od, layer_flag, bckgrd, \n",
    "               e_bckgrd, n_fit_photons, end_geoseg, segment_id, w_surface_window_final\n",
    "            ''' \n",
    "            \n",
    "#             data['dac'] = fi[g+'/land_ice_segments/geophysical/dac'][:]\n",
    "#             data['t_dt'] = fi[g+'/land_ice_segments/delta_time'][:]\n",
    "#             data['tide_earth'] = fi[g+'/land_ice_segments/geophysical/tide_earth'][:]\n",
    "#             data['tide_load'] = fi[g+'/land_ice_segments/geophysical/tide_load'][:]\n",
    "#             data['tide_ocean'] = fi[g+'/land_ice_segments/geophysical/tide_ocean'][:]\n",
    "#             data['tide_pole'] = fi[g+'/land_ice_segments/geophysical/tide_pole'][:]\n",
    "                \n",
    "#                rgt = fi['/orbit_info/rgt'][:]                           # single value\n",
    "#                 t_ref = fi['/ancillary_data/atlas_sdp_gps_epoch'][:]     # single value\n",
    "#                 beam_type = fi[g].attrs[\"atlas_beam_type\"].decode()      # strong/weak (str)\n",
    "#                 spot_number = fi[g].attrs[\"atlas_spot_number\"].decode()  # number (str)\n",
    "        \n",
    "            # Assume all vector fields are of the length of the first. TODO - check?\n",
    "            npts = len(data['lat'])\n",
    "            data['ground_track'] = [g[1:]]*npts\n",
    "                    \n",
    "            # Make a dataframe out of our data dict and store it.\n",
    "            dataframes.append(pd.DataFrame.from_dict(data))\n",
    "        \n",
    "    return dataframes\n",
    "\n",
    "def atl06_2_df(files):\n",
    "    \"\"\"Return a single Pandas dataframe from a list of HDF5 ATL-06 data files.\n",
    "    \"\"\"\n",
    "    dataframes = []\n",
    "    for f in files:\n",
    "        dataframes.extend(read_atl06(f))\n",
    "    \n",
    "    ndfs = len(dataframes)\n",
    "    i = 0\n",
    "    \n",
    "    # pd.concat can only work with up to 10 dataframes at a time,\n",
    "    # so we need to chunk this up\n",
    "    new_dfs = []\n",
    "    while i <= ndfs:\n",
    "        i_end = i+10 if i+10 < ndfs else ndfs\n",
    "        dfs = dataframes[i:i_end]\n",
    "        if not dfs:\n",
    "            break\n",
    "        new_dfs.append(pd.concat(dfs))\n",
    "        i = i_end\n",
    "    \n",
    "    return pd.concat(new_dfs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Available ground tracks: ['/gt1l', '/gt1r', '/gt2l', '/gt2r', '/gt3l', '/gt3r']\n",
      "Available ground tracks: ['/gt1l', '/gt1r', '/gt2l', '/gt2r', '/gt3l', '/gt3r']\n",
      "Available ground tracks: ['/gt1l', '/gt1r', '/gt2l', '/gt2r', '/gt3l', '/gt3r']\n",
      "Available ground tracks: ['/gt1l', '/gt1r', '/gt2l', '/gt2r', '/gt3l', '/gt3r']\n"
     ]
    }
   ],
   "source": [
    "path = Path('download')\n",
    "dataf = atl06_2_df(path.glob('*.h5'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>h_li</th>\n",
       "      <th>s_li</th>\n",
       "      <th>q_flag</th>\n",
       "      <th>s_fg</th>\n",
       "      <th>snr</th>\n",
       "      <th>h_rb</th>\n",
       "      <th>dh_fit_dx</th>\n",
       "      <th>f_sn</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>252416.000000</td>\n",
       "      <td>252416.000000</td>\n",
       "      <td>2.524160e+05</td>\n",
       "      <td>2.524160e+05</td>\n",
       "      <td>252416.000000</td>\n",
       "      <td>252416.000000</td>\n",
       "      <td>252416.000000</td>\n",
       "      <td>2.524160e+05</td>\n",
       "      <td>2.524160e+05</td>\n",
       "      <td>2.524160e+05</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>66.969175</td>\n",
       "      <td>-47.371667</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>0.022479</td>\n",
       "      <td>0.037941</td>\n",
       "      <td>0.004300</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.672515</td>\n",
       "      <td>1.208278</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>0.148235</td>\n",
       "      <td>0.291183</td>\n",
       "      <td>0.050107</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>65.730013</td>\n",
       "      <td>-49.075188</td>\n",
       "      <td>1.244566e+03</td>\n",
       "      <td>3.356113e-03</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>3.438600e-03</td>\n",
       "      <td>-7.799568e-01</td>\n",
       "      <td>3.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>66.391515</td>\n",
       "      <td>-48.461860</td>\n",
       "      <td>1.483578e+03</td>\n",
       "      <td>1.438970e-02</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.277712e-01</td>\n",
       "      <td>-4.686356e-03</td>\n",
       "      <td>3.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>67.015728</td>\n",
       "      <td>-47.793800</td>\n",
       "      <td>1.679594e+03</td>\n",
       "      <td>2.080464e-02</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.596234e-01</td>\n",
       "      <td>-8.364916e-04</td>\n",
       "      <td>3.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>67.548462</td>\n",
       "      <td>-46.083928</td>\n",
       "      <td>2.108787e+03</td>\n",
       "      <td>3.137868e-02</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.908423e-01</td>\n",
       "      <td>3.726661e-03</td>\n",
       "      <td>3.000000e+00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>68.079999</td>\n",
       "      <td>-45.320004</td>\n",
       "      <td>3.402823e+38</td>\n",
       "      <td>3.402823e+38</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>0.941731</td>\n",
       "      <td>3.402823e+38</td>\n",
       "      <td>3.402823e+38</td>\n",
       "      <td>3.402823e+38</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 lat            lon          h_li          s_li  \\\n",
       "count  252416.000000  252416.000000  2.524160e+05  2.524160e+05   \n",
       "mean       66.969175     -47.371667           inf           inf   \n",
       "std         0.672515       1.208278           inf           inf   \n",
       "min        65.730013     -49.075188  1.244566e+03  3.356113e-03   \n",
       "25%        66.391515     -48.461860  1.483578e+03  1.438970e-02   \n",
       "50%        67.015728     -47.793800  1.679594e+03  2.080464e-02   \n",
       "75%        67.548462     -46.083928  2.108787e+03  3.137868e-02   \n",
       "max        68.079999     -45.320004  3.402823e+38  3.402823e+38   \n",
       "\n",
       "              q_flag           s_fg            snr          h_rb  \\\n",
       "count  252416.000000  252416.000000  252416.000000  2.524160e+05   \n",
       "mean        0.022479       0.037941       0.004300           inf   \n",
       "std         0.148235       0.291183       0.050107           inf   \n",
       "min         0.000000       0.000000       0.000000  3.438600e-03   \n",
       "25%         0.000000       0.000000       0.000000  1.277712e-01   \n",
       "50%         0.000000       0.000000       0.000000  1.596234e-01   \n",
       "75%         0.000000       0.000000       0.000000  1.908423e-01   \n",
       "max         1.000000       3.000000       0.941731  3.402823e+38   \n",
       "\n",
       "          dh_fit_dx          f_sn  \n",
       "count  2.524160e+05  2.524160e+05  \n",
       "mean            inf           inf  \n",
       "std             inf           inf  \n",
       "min   -7.799568e-01  3.000000e+00  \n",
       "25%   -4.686356e-03  3.000000e+00  \n",
       "50%   -8.364916e-04  3.000000e+00  \n",
       "75%    3.726661e-03  3.000000e+00  \n",
       "max    3.402823e+38  3.402823e+38  "
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    246742\n",
       "1      5674\n",
       "Name: q_flag, dtype: int64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf.q_flag.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 252416 entries, 0 to 13177\n",
      "Data columns (total 11 columns):\n",
      " #   Column        Non-Null Count   Dtype  \n",
      "---  ------        --------------   -----  \n",
      " 0   ground_track  252416 non-null  object \n",
      " 1   lat           252416 non-null  float64\n",
      " 2   lon           252416 non-null  float64\n",
      " 3   h_li          252416 non-null  float32\n",
      " 4   s_li          252416 non-null  float32\n",
      " 5   q_flag        252416 non-null  int8   \n",
      " 6   s_fg          252416 non-null  int8   \n",
      " 7   snr           252416 non-null  float32\n",
      " 8   h_rb          252416 non-null  float32\n",
      " 9   dh_fit_dx     252416 non-null  float32\n",
      " 10  f_sn          252416 non-null  float32\n",
      "dtypes: float32(6), float64(2), int8(2), object(1)\n",
      "memory usage: 14.0+ MB\n"
     ]
    }
   ],
   "source": [
    "dataf.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "import utils\n",
    "import importlib\n",
    "importlib.reload(utils)\n",
    "from utils import associate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/srv/conda/envs/notebook/lib/python3.7/site-packages/ipykernel_launcher.py:1: H5pyDeprecationWarning: The default file mode will change to 'r' (read-only) in h5py 3.0. To suppress this warning, pass the mode you need to h5py.File(), or set the global default h5.get_config().default_file_mode, or set the environment variable H5PY_DEFAULT_READONLY=1. Available modes are: 'r', 'r+', 'w', 'w-'/'x', 'a'. See the docs for details.\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    }
   ],
   "source": [
    "f_ = h5py.File('./CLDMSK_L2_VIIRS_SNPP.A2014195.1442.001.2019071103127.nc')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "building tree\n",
      "searching data\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/jovyan/CloudMask/utils.py:36: H5pyDeprecationWarning: dataset.value has been deprecated. Use dataset[()] instead.\n",
      "  extract = swath['geophysical_data'][variable].value\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ground_track</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>h_li</th>\n",
       "      <th>s_li</th>\n",
       "      <th>q_flag</th>\n",
       "      <th>s_fg</th>\n",
       "      <th>snr</th>\n",
       "      <th>h_rb</th>\n",
       "      <th>dh_fit_dx</th>\n",
       "      <th>f_sn</th>\n",
       "      <th>Integer_Cloud_Mask</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079999</td>\n",
       "      <td>-47.455941</td>\n",
       "      <td>1681.167114</td>\n",
       "      <td>0.008938</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.118632</td>\n",
       "      <td>-0.006507</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079821</td>\n",
       "      <td>-47.455997</td>\n",
       "      <td>1681.033203</td>\n",
       "      <td>0.012630</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.137092</td>\n",
       "      <td>-0.009821</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079643</td>\n",
       "      <td>-47.456053</td>\n",
       "      <td>1680.882568</td>\n",
       "      <td>0.011899</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.124785</td>\n",
       "      <td>-0.004994</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079464</td>\n",
       "      <td>-47.456110</td>\n",
       "      <td>1680.766113</td>\n",
       "      <td>0.011329</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.123428</td>\n",
       "      <td>-0.006852</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079286</td>\n",
       "      <td>-47.456168</td>\n",
       "      <td>1680.677124</td>\n",
       "      <td>0.011673</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.124423</td>\n",
       "      <td>-0.005056</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13173</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730786</td>\n",
       "      <td>-49.074994</td>\n",
       "      <td>1479.279053</td>\n",
       "      <td>0.058440</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.233734</td>\n",
       "      <td>0.003487</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13174</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730608</td>\n",
       "      <td>-49.075042</td>\n",
       "      <td>1479.295532</td>\n",
       "      <td>0.038120</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.217718</td>\n",
       "      <td>0.009203</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13175</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730430</td>\n",
       "      <td>-49.075091</td>\n",
       "      <td>1479.258545</td>\n",
       "      <td>0.034046</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.182698</td>\n",
       "      <td>-0.011706</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13176</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730251</td>\n",
       "      <td>-49.075139</td>\n",
       "      <td>1479.196045</td>\n",
       "      <td>0.037711</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.207854</td>\n",
       "      <td>-0.000793</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13177</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730073</td>\n",
       "      <td>-49.075188</td>\n",
       "      <td>1479.224854</td>\n",
       "      <td>0.042509</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.193014</td>\n",
       "      <td>-0.000508</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>252416 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      ground_track        lat        lon         h_li      s_li  q_flag  s_fg  \\\n",
       "0             gt1l  68.079999 -47.455941  1681.167114  0.008938       0     0   \n",
       "1             gt1l  68.079821 -47.455997  1681.033203  0.012630       0     0   \n",
       "2             gt1l  68.079643 -47.456053  1680.882568  0.011899       0     0   \n",
       "3             gt1l  68.079464 -47.456110  1680.766113  0.011329       0     0   \n",
       "4             gt1l  68.079286 -47.456168  1680.677124  0.011673       0     0   \n",
       "...            ...        ...        ...          ...       ...     ...   ...   \n",
       "13173         gt3r  65.730786 -49.074994  1479.279053  0.058440       0     0   \n",
       "13174         gt3r  65.730608 -49.075042  1479.295532  0.038120       0     0   \n",
       "13175         gt3r  65.730430 -49.075091  1479.258545  0.034046       0     0   \n",
       "13176         gt3r  65.730251 -49.075139  1479.196045  0.037711       0     0   \n",
       "13177         gt3r  65.730073 -49.075188  1479.224854  0.042509       0     0   \n",
       "\n",
       "       snr      h_rb  dh_fit_dx  f_sn  Integer_Cloud_Mask  \n",
       "0      0.0  0.118632  -0.006507   3.0                   3  \n",
       "1      0.0  0.137092  -0.009821   3.0                   3  \n",
       "2      0.0  0.124785  -0.004994   3.0                   3  \n",
       "3      0.0  0.123428  -0.006852   3.0                   3  \n",
       "4      0.0  0.124423  -0.005056   3.0                   3  \n",
       "...    ...       ...        ...   ...                 ...  \n",
       "13173  0.0  0.233734   0.003487   3.0                   3  \n",
       "13174  0.0  0.217718   0.009203   3.0                   3  \n",
       "13175  0.0  0.182698  -0.011706   3.0                   3  \n",
       "13176  0.0  0.207854  -0.000793   3.0                   3  \n",
       "13177  0.0  0.193014  -0.000508   3.0                   3  \n",
       "\n",
       "[252416 rows x 12 columns]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "associate(dataf,f_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>h_li</th>\n",
       "      <th>s_li</th>\n",
       "      <th>q_flag</th>\n",
       "      <th>s_fg</th>\n",
       "      <th>snr</th>\n",
       "      <th>h_rb</th>\n",
       "      <th>dh_fit_dx</th>\n",
       "      <th>f_sn</th>\n",
       "      <th>Integer_Cloud_Mask</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>252416.000000</td>\n",
       "      <td>252416.000000</td>\n",
       "      <td>2.524160e+05</td>\n",
       "      <td>2.524160e+05</td>\n",
       "      <td>252416.000000</td>\n",
       "      <td>252416.000000</td>\n",
       "      <td>252416.000000</td>\n",
       "      <td>2.524160e+05</td>\n",
       "      <td>2.524160e+05</td>\n",
       "      <td>2.524160e+05</td>\n",
       "      <td>252416.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>66.969175</td>\n",
       "      <td>-47.371667</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>0.022479</td>\n",
       "      <td>0.037941</td>\n",
       "      <td>0.004300</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>2.702986</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.672515</td>\n",
       "      <td>1.208278</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>0.148235</td>\n",
       "      <td>0.291183</td>\n",
       "      <td>0.050107</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>inf</td>\n",
       "      <td>0.880359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>65.730013</td>\n",
       "      <td>-49.075188</td>\n",
       "      <td>1.244566e+03</td>\n",
       "      <td>3.356113e-03</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>3.438600e-03</td>\n",
       "      <td>-7.799568e-01</td>\n",
       "      <td>3.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>66.391515</td>\n",
       "      <td>-48.461860</td>\n",
       "      <td>1.483578e+03</td>\n",
       "      <td>1.438970e-02</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.277712e-01</td>\n",
       "      <td>-4.686356e-03</td>\n",
       "      <td>3.000000e+00</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>67.015728</td>\n",
       "      <td>-47.793800</td>\n",
       "      <td>1.679594e+03</td>\n",
       "      <td>2.080464e-02</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.596234e-01</td>\n",
       "      <td>-8.364916e-04</td>\n",
       "      <td>3.000000e+00</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>67.548462</td>\n",
       "      <td>-46.083928</td>\n",
       "      <td>2.108787e+03</td>\n",
       "      <td>3.137868e-02</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.908423e-01</td>\n",
       "      <td>3.726661e-03</td>\n",
       "      <td>3.000000e+00</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>68.079999</td>\n",
       "      <td>-45.320004</td>\n",
       "      <td>3.402823e+38</td>\n",
       "      <td>3.402823e+38</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>0.941731</td>\n",
       "      <td>3.402823e+38</td>\n",
       "      <td>3.402823e+38</td>\n",
       "      <td>3.402823e+38</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 lat            lon          h_li          s_li  \\\n",
       "count  252416.000000  252416.000000  2.524160e+05  2.524160e+05   \n",
       "mean       66.969175     -47.371667           inf           inf   \n",
       "std         0.672515       1.208278           inf           inf   \n",
       "min        65.730013     -49.075188  1.244566e+03  3.356113e-03   \n",
       "25%        66.391515     -48.461860  1.483578e+03  1.438970e-02   \n",
       "50%        67.015728     -47.793800  1.679594e+03  2.080464e-02   \n",
       "75%        67.548462     -46.083928  2.108787e+03  3.137868e-02   \n",
       "max        68.079999     -45.320004  3.402823e+38  3.402823e+38   \n",
       "\n",
       "              q_flag           s_fg            snr          h_rb  \\\n",
       "count  252416.000000  252416.000000  252416.000000  2.524160e+05   \n",
       "mean        0.022479       0.037941       0.004300           inf   \n",
       "std         0.148235       0.291183       0.050107           inf   \n",
       "min         0.000000       0.000000       0.000000  3.438600e-03   \n",
       "25%         0.000000       0.000000       0.000000  1.277712e-01   \n",
       "50%         0.000000       0.000000       0.000000  1.596234e-01   \n",
       "75%         0.000000       0.000000       0.000000  1.908423e-01   \n",
       "max         1.000000       3.000000       0.941731  3.402823e+38   \n",
       "\n",
       "          dh_fit_dx          f_sn  Integer_Cloud_Mask  \n",
       "count  2.524160e+05  2.524160e+05       252416.000000  \n",
       "mean            inf           inf            2.702986  \n",
       "std             inf           inf            0.880359  \n",
       "min   -7.799568e-01  3.000000e+00            0.000000  \n",
       "25%   -4.686356e-03  3.000000e+00            3.000000  \n",
       "50%   -8.364916e-04  3.000000e+00            3.000000  \n",
       "75%    3.726661e-03  3.000000e+00            3.000000  \n",
       "max    3.402823e+38  3.402823e+38            3.000000  "
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "import xarray as xr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [],
   "source": [
    "xray = xr.Dataset.from_dataframe(dataf)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide data repr</title>\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide attributes</title>\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt, dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2 {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><div class='xr-wrap'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-97cfca64-8e29-480e-b8a3-66de580d5cc0' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-97cfca64-8e29-480e-b8a3-66de580d5cc0' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>index</span>: 252416</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-6dc499b4-01a8-4b81-b1ff-913293faf0cf' class='xr-section-summary-in' type='checkbox'  checked><label for='section-6dc499b4-01a8-4b81-b1ff-913293faf0cf' class='xr-section-summary' >Coordinates: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>index</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 ... 13174 13175 13176 13177</div><input id='attrs-e540d06c-e496-4749-8e50-70d2bf976ffb' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e540d06c-e496-4749-8e50-70d2bf976ffb' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-bd3bc57d-b85e-442d-9146-3ec1b32567e2' class='xr-var-data-in' type='checkbox'><label for='data-bd3bc57d-b85e-442d-9146-3ec1b32567e2' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([    0,     1,     2, ..., 13175, 13176, 13177])</pre></li></ul></div></li><li class='xr-section-item'><input id='section-7d9a13a0-29b2-4745-b198-245cf6c39ef5' class='xr-section-summary-in' type='checkbox'  checked><label for='section-7d9a13a0-29b2-4745-b198-245cf6c39ef5' class='xr-section-summary' >Data variables: <span>(13)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>ground_track</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;gt1l&#x27; &#x27;gt1l&#x27; ... &#x27;gt3r&#x27; &#x27;gt3r&#x27;</div><input id='attrs-7b36a4a2-4b23-466a-aac8-6beaf993524e' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-7b36a4a2-4b23-466a-aac8-6beaf993524e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5700ebba-21e6-4bb9-b576-77bafa2c0205' class='xr-var-data-in' type='checkbox'><label for='data-5700ebba-21e6-4bb9-b576-77bafa2c0205' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([&#x27;gt1l&#x27;, &#x27;gt1l&#x27;, &#x27;gt1l&#x27;, ..., &#x27;gt3r&#x27;, &#x27;gt3r&#x27;, &#x27;gt3r&#x27;], dtype=object)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>68.08 68.08 68.08 ... 65.73 65.73</div><input id='attrs-683ed49d-6fb7-41bc-99bb-c7fc67dbfbe4' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-683ed49d-6fb7-41bc-99bb-c7fc67dbfbe4' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2dea881f-abef-41ae-b792-b0e8378554c0' class='xr-var-data-in' type='checkbox'><label for='data-2dea881f-abef-41ae-b792-b0e8378554c0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([68.07999907, 68.07982081, 68.07964258, ..., 65.73042956,\n",
       "       65.73025116, 65.73007276])</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>lon</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-47.46 -47.46 ... -49.08 -49.08</div><input id='attrs-e0b97872-0072-4aff-af74-901a3fb0e3b7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e0b97872-0072-4aff-af74-901a3fb0e3b7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b87c0a0d-a2c3-45f7-8461-1a3a9b2d8ee2' class='xr-var-data-in' type='checkbox'><label for='data-b87c0a0d-a2c3-45f7-8461-1a3a9b2d8ee2' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([-47.45594147, -47.45599716, -47.45605314, ..., -49.07509074,\n",
       "       -49.07513916, -49.07518767])</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>h_li</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>1681.1671 1681.0332 ... 1479.2249</div><input id='attrs-58e2ddff-fec8-4fa6-911d-9c57c0cbbbfc' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-58e2ddff-fec8-4fa6-911d-9c57c0cbbbfc' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d91ca53d-cc9c-4d12-aede-1ba4f6d6abaa' class='xr-var-data-in' type='checkbox'><label for='data-d91ca53d-cc9c-4d12-aede-1ba4f6d6abaa' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([1681.1671, 1681.0332, 1680.8826, ..., 1479.2585, 1479.196 ,\n",
       "       1479.2249], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>s_li</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.008938037 ... 0.042509172</div><input id='attrs-3b8764f1-4887-406e-bb31-91fcfa109aee' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3b8764f1-4887-406e-bb31-91fcfa109aee' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ea42cdcb-3e9a-4260-9acc-5fde47428f25' class='xr-var-data-in' type='checkbox'><label for='data-ea42cdcb-3e9a-4260-9acc-5fde47428f25' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0.00893804, 0.01263031, 0.01189887, ..., 0.03404627, 0.03771126,\n",
       "       0.04250917], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>q_flag</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int8</div><div class='xr-var-preview xr-preview'>0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0</div><input id='attrs-6621c08f-967d-4fce-a7f6-770fbd5c4bbd' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6621c08f-967d-4fce-a7f6-770fbd5c4bbd' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7d345fd4-975d-4325-afaa-06c75304194d' class='xr-var-data-in' type='checkbox'><label for='data-7d345fd4-975d-4325-afaa-06c75304194d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0, 0, 0, ..., 0, 0, 0], dtype=int8)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>s_fg</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int8</div><div class='xr-var-preview xr-preview'>0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0</div><input id='attrs-0b4ae45d-14fc-44b3-aabe-820255084dbf' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-0b4ae45d-14fc-44b3-aabe-820255084dbf' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5998a0e9-8b24-4c34-96a8-ec48746939e4' class='xr-var-data-in' type='checkbox'><label for='data-5998a0e9-8b24-4c34-96a8-ec48746939e4' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0, 0, 0, ..., 0, 0, 0], dtype=int8)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>snr</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0</div><input id='attrs-90431fa0-2e78-424c-953b-6cc8b9d6b568' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-90431fa0-2e78-424c-953b-6cc8b9d6b568' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1edc20fd-01ef-473c-8233-6e76418d55da' class='xr-var-data-in' type='checkbox'><label for='data-1edc20fd-01ef-473c-8233-6e76418d55da' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0., 0., 0., ..., 0., 0., 0.], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>h_rb</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.11863171 ... 0.19301407</div><input id='attrs-0f83c862-17fe-434f-b187-d40ac0775f6e' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-0f83c862-17fe-434f-b187-d40ac0775f6e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c80b3335-e2fa-4706-96e7-9f0ba9115eb1' class='xr-var-data-in' type='checkbox'><label for='data-c80b3335-e2fa-4706-96e7-9f0ba9115eb1' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0.11863171, 0.13709156, 0.124785  , ..., 0.18269826, 0.20785435,\n",
       "       0.19301407], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>dh_fit_dx</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>-0.006507039 ... -0.0005083084</div><input id='attrs-ddc67e75-0048-400b-8949-38216c4bde15' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ddc67e75-0048-400b-8949-38216c4bde15' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-46055252-de9d-43b5-84d0-597cec2be4e8' class='xr-var-data-in' type='checkbox'><label for='data-46055252-de9d-43b5-84d0-597cec2be4e8' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([-0.00650704, -0.00982141, -0.00499424, ..., -0.01170564,\n",
       "       -0.0007925 , -0.00050831], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>f_sn</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>3.0 3.0 3.0 3.0 ... 3.0 3.0 3.0 3.0</div><input id='attrs-39c6e0dd-6be2-4596-a697-1ed42dac5fd0' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-39c6e0dd-6be2-4596-a697-1ed42dac5fd0' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ea8f726f-5ee6-4ac7-8eb5-6cf96a971dc0' class='xr-var-data-in' type='checkbox'><label for='data-ea8f726f-5ee6-4ac7-8eb5-6cf96a971dc0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([3., 3., 3., ..., 3., 3., 3.], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>Integer_Cloud_Mask</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int8</div><div class='xr-var-preview xr-preview'>3 3 3 3 3 3 3 3 ... 3 3 3 3 3 3 3 3</div><input id='attrs-bca0356f-32c6-492f-97f5-f29756ec9c70' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-bca0356f-32c6-492f-97f5-f29756ec9c70' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-db4e5374-e8b7-4cce-8630-988bd6959a68' class='xr-var-data-in' type='checkbox'><label for='data-db4e5374-e8b7-4cce-8630-988bd6959a68' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([3, 3, 3, ..., 3, 3, 3], dtype=int8)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>idx</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>10024279 10024279 ... 9202093</div><input id='attrs-b17a3d99-0fcc-4087-b55f-eb66d2cfa43b' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-b17a3d99-0fcc-4087-b55f-eb66d2cfa43b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-3cd5272a-a63d-45f5-bce9-3c727c2d8230' class='xr-var-data-in' type='checkbox'><label for='data-3cd5272a-a63d-45f5-bce9-3c727c2d8230' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([10024279, 10024279, 10024279, ...,  9202093,  9202093,  9202093])</pre></li></ul></div></li><li class='xr-section-item'><input id='section-d99fad8e-12cc-4bf4-9bcb-8632ed2ab623' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-d99fad8e-12cc-4bf4-9bcb-8632ed2ab623' class='xr-section-summary'  title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.Dataset>\n",
       "Dimensions:             (index: 252416)\n",
       "Coordinates:\n",
       "  * index               (index) int64 0 1 2 3 4 ... 13174 13175 13176 13177\n",
       "Data variables:\n",
       "    ground_track        (index) object 'gt1l' 'gt1l' 'gt1l' ... 'gt3r' 'gt3r'\n",
       "    lat                 (index) float64 68.08 68.08 68.08 ... 65.73 65.73 65.73\n",
       "    lon                 (index) float64 -47.46 -47.46 -47.46 ... -49.08 -49.08\n",
       "    h_li                (index) float32 1681.1671 1681.0332 ... 1479.2249\n",
       "    s_li                (index) float32 0.008938037 0.012630311 ... 0.042509172\n",
       "    q_flag              (index) int8 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0\n",
       "    s_fg                (index) int8 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0\n",
       "    snr                 (index) float32 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n",
       "    h_rb                (index) float32 0.11863171 0.13709156 ... 0.19301407\n",
       "    dh_fit_dx           (index) float32 -0.006507039 ... -0.0005083084\n",
       "    f_sn                (index) float32 3.0 3.0 3.0 3.0 3.0 ... 3.0 3.0 3.0 3.0\n",
       "    Integer_Cloud_Mask  (index) int8 3 3 3 3 3 3 3 3 3 3 ... 3 3 3 3 3 3 3 3 3 3\n",
       "    idx                 (index) int64 10024279 10024279 ... 9202093 9202093"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xray"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.neighbors import BallTree\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [],
   "source": [
    "def associate2(dataframe, swath, variable='Integer_Cloud_Mask'):\n",
    "    \"\"\"Takes a dataframe, and a satellite file, and extracts the\n",
    "    selected variable as a new column.\n",
    "\n",
    "    Assumes that data coordinates are in lat/lon\n",
    "    Assumes dataframe higher resolution than swath\"\"\"\n",
    "    \n",
    "    # grab swath coordinates\n",
    "    # TODO; make general for inferring lat/lon paths\n",
    "    latS = np.array(swath['geolocation_data']['latitude'])\n",
    "    lonS = np.array(swath['geolocation_data']['longitude'])\n",
    "\n",
    "    S_rad = np.vstack([lonS[:].ravel(),latS[:].ravel()]).T\n",
    "    S_rad *= np.pi / 180.\n",
    "\n",
    "    # grab dataframe coords\n",
    "    latF = dataframe.lat.values\n",
    "    lonF = dataframe.lon.values\n",
    "\n",
    "    F_rad = np.vstack([lonF[:].ravel(),latF[:].ravel()]).T\n",
    "    F_rad *= np.pi / 180.\n",
    "\n",
    "    # build spatial tree; find matches\n",
    "    print(\"building tree\")\n",
    "    S_Ball = BallTree(S_rad,metric='haversine')\n",
    "    print(\"searching data\")\n",
    "    indicies = S_Ball.query(F_rad, k=1,\n",
    "                            breadth_first=True,\n",
    "                            return_distance=False)\n",
    "    \n",
    "    extract = swath['geophysical_data'][variable].value\n",
    "    new_column = extract.ravel()[indicies]\n",
    "    dataframe[variable] = new_column\n",
    "\n",
    "    # get data for overlay\n",
    "    shp = swath['geophysical_data'][variable].shape\n",
    "    mask = np.zeros_like(extract, dtype=bool)\n",
    "    mask.ravel()[indicies] = True\n",
    "    return mask, indicies\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "building tree\n",
      "searching data\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/srv/conda/envs/notebook/lib/python3.7/site-packages/ipykernel_launcher.py:31: H5pyDeprecationWarning: dataset.value has been deprecated. Use dataset[()] instead.\n"
     ]
    }
   ],
   "source": [
    "mask, idx = associate2(dataf,f_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f4ae8a66b10>"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAL0AAAD8CAYAAAAi06X5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAOAUlEQVR4nO3df4xlZX3H8ffHBVYtGqquhhS2iwmxRVMXnCCExrRQFZSg/zSBpI1pTLZ/2AbSJmbRpMY/SNAmDf2jbULUlkaE4A+iIUQl/oiaNOAsLBW6bAWKugHdVUPQmqjg1z/uGT3M3pk5v55znnOfzyuZzJ0zd+7zzORzv/OcH/d7FRGYleQFU0/AbGwOvRXHobfiOPRWHIfeiuPQW3EmD72kyyUdlfSopIMDP/bHJB2X9FBt28sk3SPp29Xn36197/pqHkclvbXjmGdL+oqkI5IelnTtSOO+UNJ9kh6sxv3gGONWj7NL0gOS7hprzF4iYrIPYBfwGPBq4DTgQeC8AR//TcAFwEO1bR8GDla3DwIfqm6fV42/GzinmteuDmOeCVxQ3X4J8L/VY6ceV8Dp1e1TgXuBi1KPWz3W3wGfAO4a42/cOxcTh/5i4Au1r68Hrh94jH2bQn8UOLMW0KPLxga+AFw8wPifBd485rjAi4H7gTemHhc4C/gScGkt9KP+jdt+TL28+T3ge7Wvj1XbUnpVRDwFUH1+Zaq5SNoHnM+i6iYft1pmHAaOA/dExBjj3gS8F/hVbdtof+Mupg69lmyb6rqIQeci6XTg08B1EfHMGONGxHMRsZ9F9b1Q0utSjivpSuB4RBxq+iN9xxzC1KE/Bpxd+/os4MnEY/5A0pkA1efjQ89F0qksAn9rRHxmrHE3RMTTwFeByxOPewlwlaQngNuBSyV9PPGY/Y29ntq0HjwFeJzFTs3GjuxrBx5jH89f0/8jz9/J+nB1+7U8fyfrcbrvUP4ncNOm7anH3QOcUd1+EfB14MrU49bG/xN+u6YfZczOcx17wCV/rLexOMLxGPD+gR/7NuAp4Jcsqsy7gZez2PH6dvX5ZbX7v7+ax1Hgio5j/jGLf9n/DRyuPt42wrh/BDxQjfsQ8A/V9qTj1h6rHvpRxuz6oWoiZsWYek1vNjqH3orj0FtxHHorTrLQp7yQzKyPJKGXtAv4F+AKFhcZXSPpvG3ufyDFPHbicVdzzJ2kqvQXAo9GxOMR8QsWZ+vesc39p/rDeNzVHHNbqUKfxYVFZsuckuhxd7ywqPq3dwBg9+7db1hbWxv9LNnevXvxuKs3JsChQ4d+GBF7ln0vVeh3vLAoIm4GbgZYW1uL9fX1RFOxEkn6zlbfS7W8+SZwrqRzJJ0GXA18LtFYZq0kqfQR8aykv2HxyphdwMci4uEUY5m1lWp5Q0TcDdyd6vHNuvIZWSuOQ2/FceitOA69Fceht+I49FYch96K49BbcRx6K45Db8Vx6K04Dr0Vx6G34jj0VhyH3orj0FtxHHorjkNvxXHorTgOvRXHobfi7Bj6Kd5q3iylJpX+P1i8NWPdQeBLEXEuizfSOghQdSa+msW7yF0O/GvVwdgsGzuGPiK+Bvx40+Z3ALdUt28B3lnbfntE/Dwi/g94lEUHY7NsdF3TZ/026GbbGXpHtvHboEs6IGld0vqJEycGnobZ1rqGvvfboEfEzRGxFhFre/Ys7ahslkTX0H8OeFd1+13AZ2vbr5a0W9I5wLnAff2maDasHRu4SrqNxVugv0LSMeADwI3AHZLeDXwX+HOAiHhY0h3A/wDPAu+JiOcSzd2skx1DHxHXbPGty7a4/w3ADX0mZZaSz8hacRx6K45Db8Vx6K04Dr0Vx6G34jj0VhyH3orj0FtxHHorjkNvxXHorTgOvRXHobfiOPRWHIfeiuPQW3EceiuOQ2/FceitOA69FadJ1+KzJX1F0hFJD0u6ttruzsU2S00q/bPA30fEHwIXAe+puhO7c7HNUpOuxU9FxP3V7Z8AR1g0ZXXnYpulVmt6SfuA84F76dm52A1cbSqNQy/pdODTwHUR8cx2d12y7aTOxW7galNpFHpJp7II/K0R8Zlqc+/OxWZTaHL0RsBHgSMR8U+1b7lzsc3Sjg1cgUuAvwS+Jelwte19uHOxzVSTrsXfYPk6Hdy52GbIZ2StOA69Fceht+I49FYch96K49BbcRx6K45Db8Vx6K04Dr0Vx6G34jj0VhyH3orj0FtxHHorjkNvxXHoZ2Txyk3ry6GfkYhw8Afg0M9MxEndVKwlh34mJLnKD6RJC5AXSrpP0oNVA9cPVtvdwHVEEeHlzUCaVPqfA5dGxOuB/cDlki7CDVwn4eVNf00auEZE/LT68tTqI3AD19G4ug+raVu/XVWjp+PAPRHRu4GrNefqPqxGoY+I5yJiP4u+lBdKet02d2/UwNVdi20qrY7eRMTTwFdZrNV7NXB11+JmfNRmeE2O3uyRdEZ1+0XAnwGP4Aauo/BRm+E1aeB6JnBLdQTmBcAdEXGXpP/CDVxH43X9cJTDH3NtbS3W19ennkZ2JDnsHUk6FBFry77nM7IZc+DTcOgz5TV8Og59przzmo5DnzEHPw2HPnNe1w/Poc+Yq3waDn3GXOXTcOgz4+qenkOfmY2d1xzDn+OcunDoM7RxvU1uVuVokkOfmdxDleOTsS2HPjO5V9Oc59aUQ5+h3KppfR8jt7l10eTSYhtBzqHKcU59uNJnIucXi+R6NKkrhz4D9UDlWFVzPZrUlUOfgZyPzUP7nddcf48NDn0mcqumXf775LxfUufQ21JdgrvxM670NktdljRzqfQ+ZGlLtQ1u7kGva1zpq9Z+D0i6q/raXYt7WrWd11x/l83aLG+uBY7UvnbX4p5yPjbfZed1LtW+aQPXs4C3Ax+pbXbX4oHMJSzL5Pqk3U7TSn8T8F7gV7Vt7lrcU25Lgq5zmduTtkkvyyuB4xFxqOFjumtxQ7ktCXKaS0pNKv0lwFWSngBuBy6V9HHctbiznKp7Xa7zGlqTdyK5PiLOioh9LHZQvxwRf4G7FneW6zq47c7rXPU5Tn8j7lr8G22brW4Ef45LijnPHdy1eHS5nbVsG965hN1dizOS27H5VT7zuhWHfgBdApxLeHJ58o3JoR9ALgFuKvcXraTm0Beoa9BX5b+CQ9/THINQypnXrfjS4p7m9KqiHOaQA1f6HtpUzByO2uQwhxw49D30eUnd2Erfea1z6Ecy9RWVpe+81nlNP5K5Vte5zns7rvSJTV0p+4w/9X+nVFzpE5u6UvZZ1kw991Rc6Vta1eq32Sof5XGlb6ntFYltfyYnc533TlzpW2hb+eZ2XHwu8+zLoW+ha4DHrph9LzNY9fA79C21Xd6MHaA+O6BzX4415dAnNEW3gz7LqTktxfpw6BOYOjhdnmilVHlw6Hc0hzX8Zm3mXFLYNzj0O8j9XUKWaduVoTRNe1k+Ielbkg5LWq+2FdO1uM3afKqd1yl+dq7aVPo/jYj9tbYKRXQtnsOx+T7V2pW+nSK6Fud+bL7ESt1X09AH8EVJhyQdqLYV07U452rY5YRS6U+UptfeXBIRT0p6JXCPpEe2uW/jrsXAAYC9e/c2nMa45nCl4cYc2+xz5P47pdao0kfEk9Xn48CdLJYrK9+1uMvFZWPpeqixlBNQ22nSn/53JL1k4zbwFuAhVrhrcc5r+M3j+Zh8e02WN68C7qz+YKcAn4iIz0v6JivatbheDXMNSNtlDTz/iZLr7zUGdy0ewJhPkNID25S7FreU87H5Ui7/TcmhX6JNgKfqJ+Nq351Dv4WmoZriaIiPyffj0A9gqiM3Q9+3FA79El2WNrmawxzH5tBXuqzN53Cix5X+ZA59pWs4xjpMOcXPriqHvqMxrpsf4vi/K/3JHPpKjsfmfQVlGg59pevFZSkraZdK78q+M4e+g7GC1fY/ydxeyzsV97LMWNvrbFzlm3Glz1jbELvKN1N06HMLSd/5uNI3U3Toczu51De0Of0uOSs69JDPSwKHOAHlSt9MsaHv+pLAVEdI/PK/8RQb+rYhqwcsRcg2nkw+WpNesaHfkMvFZV2eTF7Dd1N86NtIGfw5dGBYFQ59A/V1fKqg9ekpb+007Vp8hqRPSXpE0hFJF5fYtXjIkA3xWK703TSt9P8MfD4i/gB4PXCEQroW1w0VMrfxmFaTDmcvBd4EfBQgIn4REU9TSNfiFHI7KVaaJpX+1cAJ4N8lPSDpI1V7v15diyUdkLQuaf3EiRO9fokxDBXSPvsGfqIMo0noTwEuAP4tIs4H/p9qKbOFRl2L59DAtW6o5YhPQk2vSeiPAcci4t7q60+xeBL06lpcqq4vDPG18sPZMfQR8X3ge5JeU226jEVz1pXtWpxS1xNQqc4El6jpi0j+FrhV0mnA48BfsXjCrGTX4pS6XmrgIz7DcdfizDns3bhr8YS6rsO985qOQ59Y3yZS3nkdnkOfmF8CmB+HPpH68sTNmvLi0CfS9aiLlzXpOfSJ9Tkub2m42VMmHPbxuNJnYsw3ayudQ58JV/rxOPSZcNjH49BbcRx6K45Db8Vx6K04Dr0Vx6G34jj0VhyH3orj0FtxHHorTpO2fq+RdLj28Yyk60pq4GqrpUnfm6MRsT8i9gNvAH4G3EmBDVxtNbRd3lwGPBYR38ENXG2m2ob+auC26navBq5mU2kc+qq72VXAJ3e665JtJ103O7euxbY62lT6K4D7I+IH1de9GrjOrWuxrY42ob+G3y5twA1cbaYavTBc0ouBNwN/Xdt8I27gajPUKPQR8TPg5Zu2/YjF0Zxl978BuKH37MwS8BlZK45Db8Vx6K04Dr0VJ4t3IpH0E+DoBEO/Avihx125MQF+PyKWngDKpZfl0a3eKiUlSesed/XG3ImXN1Ych96Kk0vob/a4KzvuVL/rlrLYkTUbUy6V3mw0Dr0Vx6G34jj0VhyH3orza/grRwhv2uZvAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.spy(mask[2500:,1700:2200])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Populating the interactive namespace from numpy and matplotlib\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/srv/conda/envs/notebook/lib/python3.7/site-packages/IPython/core/magics/pylab.py:160: UserWarning: pylab import has clobbered these variables: ['f']\n",
      "`%matplotlib` prevents importing * from pylab and numpy\n",
      "  \"\\n`%matplotlib` prevents importing * from pylab and numpy\"\n"
     ]
    }
   ],
   "source": [
    "%pylab inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide data repr</title>\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide attributes</title>\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt, dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2 {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><div class='xr-wrap'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-aa14078c-abf7-40d0-beda-2db6b6faa441' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-aa14078c-abf7-40d0-beda-2db6b6faa441' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>index</span>: 252416</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-ad11cb68-bb1b-480b-a2f0-67dfe8df12cc' class='xr-section-summary-in' type='checkbox'  checked><label for='section-ad11cb68-bb1b-480b-a2f0-67dfe8df12cc' class='xr-section-summary' >Coordinates: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>index</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 ... 13174 13175 13176 13177</div><input id='attrs-987b01bf-528d-43c7-8495-0aa88a42b070' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-987b01bf-528d-43c7-8495-0aa88a42b070' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-3503a24c-c366-4421-8433-9c87db0650a0' class='xr-var-data-in' type='checkbox'><label for='data-3503a24c-c366-4421-8433-9c87db0650a0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([    0,     1,     2, ..., 13175, 13176, 13177])</pre></li></ul></div></li><li class='xr-section-item'><input id='section-45136072-a220-4922-b165-3e49fee11b15' class='xr-section-summary-in' type='checkbox'  checked><label for='section-45136072-a220-4922-b165-3e49fee11b15' class='xr-section-summary' >Data variables: <span>(12)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>ground_track</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;gt1l&#x27; &#x27;gt1l&#x27; ... &#x27;gt3r&#x27; &#x27;gt3r&#x27;</div><input id='attrs-ba0c9cd9-9383-4371-b911-6f2709b3cec2' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ba0c9cd9-9383-4371-b911-6f2709b3cec2' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c95934e2-5f5c-4b77-bce0-097fa5f1dfdf' class='xr-var-data-in' type='checkbox'><label for='data-c95934e2-5f5c-4b77-bce0-097fa5f1dfdf' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([&#x27;gt1l&#x27;, &#x27;gt1l&#x27;, &#x27;gt1l&#x27;, ..., &#x27;gt3r&#x27;, &#x27;gt3r&#x27;, &#x27;gt3r&#x27;], dtype=object)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>68.08 68.08 68.08 ... 65.73 65.73</div><input id='attrs-15cda455-c257-4baf-a62f-8a789733c443' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-15cda455-c257-4baf-a62f-8a789733c443' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5e31a7d9-e436-4183-8984-69a43916e4d3' class='xr-var-data-in' type='checkbox'><label for='data-5e31a7d9-e436-4183-8984-69a43916e4d3' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([68.07999907, 68.07982081, 68.07964258, ..., 65.73042956,\n",
       "       65.73025116, 65.73007276])</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>lon</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-47.46 -47.46 ... -49.08 -49.08</div><input id='attrs-e46074ad-9868-47ea-9816-e413564cdbe2' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e46074ad-9868-47ea-9816-e413564cdbe2' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a4d03fe3-c27c-49a7-ac63-b2c8f0d33351' class='xr-var-data-in' type='checkbox'><label for='data-a4d03fe3-c27c-49a7-ac63-b2c8f0d33351' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([-47.45594147, -47.45599716, -47.45605314, ..., -49.07509074,\n",
       "       -49.07513916, -49.07518767])</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>h_li</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>1681.1671 1681.0332 ... 1479.2249</div><input id='attrs-b10215c5-fb1e-4044-8104-08c86538db54' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-b10215c5-fb1e-4044-8104-08c86538db54' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-eb86622d-7951-4113-9d90-17efc48dea78' class='xr-var-data-in' type='checkbox'><label for='data-eb86622d-7951-4113-9d90-17efc48dea78' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([1681.1671, 1681.0332, 1680.8826, ..., 1479.2585, 1479.196 ,\n",
       "       1479.2249], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>s_li</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.008938037 ... 0.042509172</div><input id='attrs-6ad26a36-930f-45f0-9d00-e6f786aca696' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-6ad26a36-930f-45f0-9d00-e6f786aca696' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7a94fc75-c6e8-408d-813a-22419aa5b82a' class='xr-var-data-in' type='checkbox'><label for='data-7a94fc75-c6e8-408d-813a-22419aa5b82a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0.00893804, 0.01263031, 0.01189887, ..., 0.03404627, 0.03771126,\n",
       "       0.04250917], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>q_flag</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int8</div><div class='xr-var-preview xr-preview'>0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0</div><input id='attrs-3c64ffd2-667a-4f2c-badb-15bed64ac83b' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3c64ffd2-667a-4f2c-badb-15bed64ac83b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d29a8c75-dfc4-44d7-aa0a-ae78a89d6807' class='xr-var-data-in' type='checkbox'><label for='data-d29a8c75-dfc4-44d7-aa0a-ae78a89d6807' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0, 0, 0, ..., 0, 0, 0], dtype=int8)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>s_fg</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int8</div><div class='xr-var-preview xr-preview'>0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0</div><input id='attrs-c8bf69c0-a8ba-4ed3-83e4-083d71ef1e51' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-c8bf69c0-a8ba-4ed3-83e4-083d71ef1e51' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-76310c5f-19fa-46bd-a14d-4769e5b2823f' class='xr-var-data-in' type='checkbox'><label for='data-76310c5f-19fa-46bd-a14d-4769e5b2823f' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0, 0, 0, ..., 0, 0, 0], dtype=int8)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>snr</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0</div><input id='attrs-653cf3e8-315c-4193-8fd1-790c992a51a8' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-653cf3e8-315c-4193-8fd1-790c992a51a8' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-13dd2da1-02e5-4ecd-b3e1-4f49aa863b5e' class='xr-var-data-in' type='checkbox'><label for='data-13dd2da1-02e5-4ecd-b3e1-4f49aa863b5e' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0., 0., 0., ..., 0., 0., 0.], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>h_rb</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.11863171 ... 0.19301407</div><input id='attrs-657f1f05-2f3b-4dc6-9dd2-45e2bc5b9ce7' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-657f1f05-2f3b-4dc6-9dd2-45e2bc5b9ce7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-247e1ebc-5344-4024-bd83-07d3ca958d3c' class='xr-var-data-in' type='checkbox'><label for='data-247e1ebc-5344-4024-bd83-07d3ca958d3c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0.11863171, 0.13709156, 0.124785  , ..., 0.18269826, 0.20785435,\n",
       "       0.19301407], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>dh_fit_dx</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>-0.006507039 ... -0.0005083084</div><input id='attrs-ff0614f4-3959-45d8-b078-0fe679784672' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ff0614f4-3959-45d8-b078-0fe679784672' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-33198ec5-f151-4c32-ba58-4401c4a367be' class='xr-var-data-in' type='checkbox'><label for='data-33198ec5-f151-4c32-ba58-4401c4a367be' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([-0.00650704, -0.00982141, -0.00499424, ..., -0.01170564,\n",
       "       -0.0007925 , -0.00050831], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>f_sn</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>3.0 3.0 3.0 3.0 ... 3.0 3.0 3.0 3.0</div><input id='attrs-3aca88b3-e79d-4226-a5a8-762cbd700c30' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-3aca88b3-e79d-4226-a5a8-762cbd700c30' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-71a51228-4aa2-489a-8cd4-ff9eeec4ee29' class='xr-var-data-in' type='checkbox'><label for='data-71a51228-4aa2-489a-8cd4-ff9eeec4ee29' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([3., 3., 3., ..., 3., 3., 3.], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>Integer_Cloud_Mask</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int8</div><div class='xr-var-preview xr-preview'>3 3 3 3 3 3 3 3 ... 3 3 3 3 3 3 3 3</div><input id='attrs-f8587a97-d1e6-4a31-9748-d0a78d044a43' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-f8587a97-d1e6-4a31-9748-d0a78d044a43' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-1628cb28-c9a0-4b7d-9066-9791dda186de' class='xr-var-data-in' type='checkbox'><label for='data-1628cb28-c9a0-4b7d-9066-9791dda186de' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([3, 3, 3, ..., 3, 3, 3], dtype=int8)</pre></li></ul></div></li><li class='xr-section-item'><input id='section-967a8834-f7d2-4dc6-ad3c-f6e35cf240c6' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-967a8834-f7d2-4dc6-ad3c-f6e35cf240c6' class='xr-section-summary'  title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.Dataset>\n",
       "Dimensions:             (index: 252416)\n",
       "Coordinates:\n",
       "  * index               (index) int64 0 1 2 3 4 ... 13174 13175 13176 13177\n",
       "Data variables:\n",
       "    ground_track        (index) object 'gt1l' 'gt1l' 'gt1l' ... 'gt3r' 'gt3r'\n",
       "    lat                 (index) float64 68.08 68.08 68.08 ... 65.73 65.73 65.73\n",
       "    lon                 (index) float64 -47.46 -47.46 -47.46 ... -49.08 -49.08\n",
       "    h_li                (index) float32 1681.1671 1681.0332 ... 1479.2249\n",
       "    s_li                (index) float32 0.008938037 0.012630311 ... 0.042509172\n",
       "    q_flag              (index) int8 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0\n",
       "    s_fg                (index) int8 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0\n",
       "    snr                 (index) float32 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n",
       "    h_rb                (index) float32 0.11863171 0.13709156 ... 0.19301407\n",
       "    dh_fit_dx           (index) float32 -0.006507039 ... -0.0005083084\n",
       "    f_sn                (index) float32 3.0 3.0 3.0 3.0 3.0 ... 3.0 3.0 3.0 3.0\n",
       "    Integer_Cloud_Mask  (index) int8 3 3 3 3 3 3 3 3 3 3 ... 3 3 3 3 3 3 3 3 3 3"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xray"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10024279],\n",
       "       [10021080],\n",
       "       [10021080],\n",
       "       [10021080],\n",
       "       [10021080]])"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "idx[:50]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [],
   "source": [
    "dataf['idx'] = idx"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ground_track</th>\n",
       "      <th>lat</th>\n",
       "      <th>lon</th>\n",
       "      <th>h_li</th>\n",
       "      <th>s_li</th>\n",
       "      <th>q_flag</th>\n",
       "      <th>s_fg</th>\n",
       "      <th>snr</th>\n",
       "      <th>h_rb</th>\n",
       "      <th>dh_fit_dx</th>\n",
       "      <th>f_sn</th>\n",
       "      <th>Integer_Cloud_Mask</th>\n",
       "      <th>idx</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079999</td>\n",
       "      <td>-47.455941</td>\n",
       "      <td>1681.167114</td>\n",
       "      <td>0.008938</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.118632</td>\n",
       "      <td>-0.006507</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>10024279</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079821</td>\n",
       "      <td>-47.455997</td>\n",
       "      <td>1681.033203</td>\n",
       "      <td>0.012630</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.137092</td>\n",
       "      <td>-0.009821</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>10024279</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079643</td>\n",
       "      <td>-47.456053</td>\n",
       "      <td>1680.882568</td>\n",
       "      <td>0.011899</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.124785</td>\n",
       "      <td>-0.004994</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>10024279</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079464</td>\n",
       "      <td>-47.456110</td>\n",
       "      <td>1680.766113</td>\n",
       "      <td>0.011329</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.123428</td>\n",
       "      <td>-0.006852</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>10024279</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>gt1l</td>\n",
       "      <td>68.079286</td>\n",
       "      <td>-47.456168</td>\n",
       "      <td>1680.677124</td>\n",
       "      <td>0.011673</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.124423</td>\n",
       "      <td>-0.005056</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>10024279</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13173</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730786</td>\n",
       "      <td>-49.074994</td>\n",
       "      <td>1479.279053</td>\n",
       "      <td>0.058440</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.233734</td>\n",
       "      <td>0.003487</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>9202093</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13174</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730608</td>\n",
       "      <td>-49.075042</td>\n",
       "      <td>1479.295532</td>\n",
       "      <td>0.038120</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.217718</td>\n",
       "      <td>0.009203</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>9202093</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13175</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730430</td>\n",
       "      <td>-49.075091</td>\n",
       "      <td>1479.258545</td>\n",
       "      <td>0.034046</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.182698</td>\n",
       "      <td>-0.011706</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>9202093</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13176</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730251</td>\n",
       "      <td>-49.075139</td>\n",
       "      <td>1479.196045</td>\n",
       "      <td>0.037711</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.207854</td>\n",
       "      <td>-0.000793</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>9202093</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13177</th>\n",
       "      <td>gt3r</td>\n",
       "      <td>65.730073</td>\n",
       "      <td>-49.075188</td>\n",
       "      <td>1479.224854</td>\n",
       "      <td>0.042509</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.193014</td>\n",
       "      <td>-0.000508</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>9202093</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>252416 rows × 13 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      ground_track        lat        lon         h_li      s_li  q_flag  s_fg  \\\n",
       "0             gt1l  68.079999 -47.455941  1681.167114  0.008938       0     0   \n",
       "1             gt1l  68.079821 -47.455997  1681.033203  0.012630       0     0   \n",
       "2             gt1l  68.079643 -47.456053  1680.882568  0.011899       0     0   \n",
       "3             gt1l  68.079464 -47.456110  1680.766113  0.011329       0     0   \n",
       "4             gt1l  68.079286 -47.456168  1680.677124  0.011673       0     0   \n",
       "...            ...        ...        ...          ...       ...     ...   ...   \n",
       "13173         gt3r  65.730786 -49.074994  1479.279053  0.058440       0     0   \n",
       "13174         gt3r  65.730608 -49.075042  1479.295532  0.038120       0     0   \n",
       "13175         gt3r  65.730430 -49.075091  1479.258545  0.034046       0     0   \n",
       "13176         gt3r  65.730251 -49.075139  1479.196045  0.037711       0     0   \n",
       "13177         gt3r  65.730073 -49.075188  1479.224854  0.042509       0     0   \n",
       "\n",
       "       snr      h_rb  dh_fit_dx  f_sn  Integer_Cloud_Mask       idx  \n",
       "0      0.0  0.118632  -0.006507   3.0                   3  10024279  \n",
       "1      0.0  0.137092  -0.009821   3.0                   3  10024279  \n",
       "2      0.0  0.124785  -0.004994   3.0                   3  10024279  \n",
       "3      0.0  0.123428  -0.006852   3.0                   3  10024279  \n",
       "4      0.0  0.124423  -0.005056   3.0                   3  10024279  \n",
       "...    ...       ...        ...   ...                 ...       ...  \n",
       "13173  0.0  0.233734   0.003487   3.0                   3   9202093  \n",
       "13174  0.0  0.217718   0.009203   3.0                   3   9202093  \n",
       "13175  0.0  0.182698  -0.011706   3.0                   3   9202093  \n",
       "13176  0.0  0.207854  -0.000793   3.0                   3   9202093  \n",
       "13177  0.0  0.193014  -0.000508   3.0                   3   9202093  \n",
       "\n",
       "[252416 rows x 13 columns]"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "idx\n",
       "8869152     2413.775146\n",
       "8872352     2412.567627\n",
       "8875551     2411.411133\n",
       "8878751     2408.125000\n",
       "8878755     2401.977051\n",
       "               ...     \n",
       "10104314    1516.200317\n",
       "10104319    1451.449829\n",
       "10107518    1444.441284\n",
       "10110717    1465.045532\n",
       "10113917    1463.444580\n",
       "Name: h_li, Length: 2475, dtype: float32"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf.groupby('idx').h_li.mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8869152     2413.775146\n",
       "8872352     2412.567627\n",
       "8875551     2411.411133\n",
       "8878751     2408.125000\n",
       "8878755     2401.977051\n",
       "               ...     \n",
       "10104314    1516.200317\n",
       "10104319    1451.449829\n",
       "10107518    1444.441284\n",
       "10110717    1465.045532\n",
       "10113917    1463.444580\n",
       "Name: h_li, Length: 2475, dtype: float32"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataf.groupby(idx.flatten()).h_li.mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(252416,)"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "shape(idx.flat)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp = xray.groupby('idx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[0;31mSignature:\u001b[0m \u001b[0mtemp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreduce\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdim\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkeep_attrs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
       "\u001b[0;31mDocstring:\u001b[0m\n",
       "Reduce the items in this group by applying `func` along some\n",
       "dimension(s).\n",
       "\n",
       "Parameters\n",
       "----------\n",
       "func : function\n",
       "    Function which can be called in the form\n",
       "    `func(x, axis=axis, **kwargs)` to return the result of collapsing\n",
       "    an np.ndarray over an integer valued axis.\n",
       "dim : `...`, str or sequence of str, optional\n",
       "    Dimension(s) over which to apply `func`.\n",
       "axis : int or sequence of int, optional\n",
       "    Axis(es) over which to apply `func`. Only one of the 'dimension'\n",
       "    and 'axis' arguments can be supplied. If neither are supplied, then\n",
       "    `func` is calculated over all dimension for each group item.\n",
       "keep_attrs : bool, optional\n",
       "    If True, the datasets's attributes (`attrs`) will be copied from\n",
       "    the original object to the new one.  If False (default), the new\n",
       "    object will be returned without attributes.\n",
       "**kwargs : dict\n",
       "    Additional keyword arguments passed on to `func`.\n",
       "\n",
       "Returns\n",
       "-------\n",
       "reduced : Array\n",
       "    Array with summarized data and the indicated dimension(s)\n",
       "    removed.\n",
       "\u001b[0;31mFile:\u001b[0m      /srv/conda/envs/notebook/lib/python3.7/site-packages/xarray/core/groupby.py\n",
       "\u001b[0;31mType:\u001b[0m      method\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "temp.reduce?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide data repr</title>\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide attributes</title>\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt, dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2 {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><div class='xr-wrap'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'idx'</div><ul class='xr-dim-list'><li><span>dim_0</span>: 252416</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-817fe7ac-c5ff-4453-8fac-afa56d2b71b5' class='xr-array-in' type='checkbox' ><label for='section-817fe7ac-c5ff-4453-8fac-afa56d2b71b5' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>10024279 10024279 10024279 10024279 ... 9202093 9202093 9202093</span></div><pre class='xr-array-data'>array([10024279, 10024279, 10024279, ...,  9202093,  9202093,  9202093])</pre></div></li><li class='xr-section-item'><input id='section-30dba859-fd7e-4cde-9aaa-e9a62ac674e4' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-30dba859-fd7e-4cde-9aaa-e9a62ac674e4' class='xr-section-summary'  title='Expand/collapse section'>Coordinates: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'></ul></div></li><li class='xr-section-item'><input id='section-32f8c875-1af2-479c-b721-91163c837def' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-32f8c875-1af2-479c-b721-91163c837def' class='xr-section-summary'  title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.DataArray 'idx' (dim_0: 252416)>\n",
       "array([10024279, 10024279, 10024279, ...,  9202093,  9202093,  9202093])\n",
       "Dimensions without coordinates: dim_0"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xr.DataArray(idx.flatten(),name='idx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide data repr</title>\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide attributes</title>\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt, dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2 {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><div class='xr-wrap'><div class='xr-header'><div class='xr-obj-type'>xarray.DataArray</div><div class='xr-array-name'>'h_li'</div><ul class='xr-dim-list'><li><span class='xr-has-index'>index</span>: 50</li></ul></div><ul class='xr-sections'><li class='xr-section-item'><div class='xr-array-wrap'><input id='section-a8971154-eeec-4254-a6eb-9cac19c2cdc9' class='xr-array-in' type='checkbox' ><label for='section-a8971154-eeec-4254-a6eb-9cac19c2cdc9' title='Show/hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-array-preview xr-preview'><span>1681.1671 1681.0332 1680.8826 ... 1677.1104 1677.0397 1676.9884</span></div><pre class='xr-array-data'>array([1681.1671, 1681.0332, 1680.8826, 1680.7661, 1680.6771, 1680.5906,\n",
       "       1680.5017, 1680.4003, 1680.3306, 1680.3057, 1680.2445, 1680.154 ,\n",
       "       1680.0974, 1680.0483, 1679.9585, 1679.8813, 1679.8041, 1679.7041,\n",
       "       1679.5951, 1679.5123, 1679.406 , 1679.2731, 1679.1458, 1679.0913,\n",
       "       1679.0428, 1678.8878, 1678.7472, 1678.6771, 1678.5955, 1678.5282,\n",
       "       1678.4364, 1678.2891, 1678.1946, 1678.114 , 1678.0094, 1677.9333,\n",
       "       1677.8728, 1677.8041, 1677.7333, 1677.6865, 1677.6263, 1677.5552,\n",
       "       1677.5076, 1677.4456, 1677.3518, 1677.2915, 1677.2076, 1677.1104,\n",
       "       1677.0397, 1676.9884], dtype=float32)</pre></div></li><li class='xr-section-item'><input id='section-b8806c21-4b8a-4070-963d-3349a1f4d6ca' class='xr-section-summary-in' type='checkbox'  checked><label for='section-b8806c21-4b8a-4070-963d-3349a1f4d6ca' class='xr-section-summary' >Coordinates: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>index</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 4 5 6 ... 44 45 46 47 48 49</div><input id='attrs-daf76b18-6349-49de-bd38-4982a2cdb0ed' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-daf76b18-6349-49de-bd38-4982a2cdb0ed' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9a69d323-ebb5-4d5b-84a2-507227b8e5f2' class='xr-var-data-in' type='checkbox'><label for='data-9a69d323-ebb5-4d5b-84a2-507227b8e5f2' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,\n",
       "       18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,\n",
       "       36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49])</pre></li></ul></div></li><li class='xr-section-item'><input id='section-2dd8851a-2d9c-46bb-afa5-b065a24ce0e2' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-2dd8851a-2d9c-46bb-afa5-b065a24ce0e2' class='xr-section-summary'  title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.DataArray 'h_li' (index: 50)>\n",
       "array([1681.1671, 1681.0332, 1680.8826, 1680.7661, 1680.6771, 1680.5906,\n",
       "       1680.5017, 1680.4003, 1680.3306, 1680.3057, 1680.2445, 1680.154 ,\n",
       "       1680.0974, 1680.0483, 1679.9585, 1679.8813, 1679.8041, 1679.7041,\n",
       "       1679.5951, 1679.5123, 1679.406 , 1679.2731, 1679.1458, 1679.0913,\n",
       "       1679.0428, 1678.8878, 1678.7472, 1678.6771, 1678.5955, 1678.5282,\n",
       "       1678.4364, 1678.2891, 1678.1946, 1678.114 , 1678.0094, 1677.9333,\n",
       "       1677.8728, 1677.8041, 1677.7333, 1677.6865, 1677.6263, 1677.5552,\n",
       "       1677.5076, 1677.4456, 1677.3518, 1677.2915, 1677.2076, 1677.1104,\n",
       "       1677.0397, 1676.9884], dtype=float32)\n",
       "Coordinates:\n",
       "  * index    (index) int64 0 1 2 3 4 5 6 7 8 9 ... 40 41 42 43 44 45 46 47 48 49"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xray.h_li[:50]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide data repr</title>\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<title>Show/Hide attributes</title>\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt, dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2 {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><div class='xr-wrap'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-e11bd0d4-9ddc-40c5-a2d6-c6185b41f980' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-e11bd0d4-9ddc-40c5-a2d6-c6185b41f980' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>index</span>: 252416</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-5ed515f6-53c4-4ea2-b308-1ff96bfa2fef' class='xr-section-summary-in' type='checkbox'  checked><label for='section-5ed515f6-53c4-4ea2-b308-1ff96bfa2fef' class='xr-section-summary' >Coordinates: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>index</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>0 1 2 3 ... 13174 13175 13176 13177</div><input id='attrs-8d7ee50c-0661-4911-852f-4d5bc8c539d5' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-8d7ee50c-0661-4911-852f-4d5bc8c539d5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-3b2c27e6-fdd6-4593-9520-9b76cad8134a' class='xr-var-data-in' type='checkbox'><label for='data-3b2c27e6-fdd6-4593-9520-9b76cad8134a' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([    0,     1,     2, ..., 13175, 13176, 13177])</pre></li></ul></div></li><li class='xr-section-item'><input id='section-215bc458-0dd4-46ab-8b59-4520a28416c3' class='xr-section-summary-in' type='checkbox'  checked><label for='section-215bc458-0dd4-46ab-8b59-4520a28416c3' class='xr-section-summary' >Data variables: <span>(13)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>ground_track</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>&#x27;gt1l&#x27; &#x27;gt1l&#x27; ... &#x27;gt3r&#x27; &#x27;gt3r&#x27;</div><input id='attrs-ccd3afaa-219c-42cb-ad68-d68ef3ea02da' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ccd3afaa-219c-42cb-ad68-d68ef3ea02da' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-f79eb768-1bc4-4e86-ac94-4549f6f23401' class='xr-var-data-in' type='checkbox'><label for='data-f79eb768-1bc4-4e86-ac94-4549f6f23401' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([&#x27;gt1l&#x27;, &#x27;gt1l&#x27;, &#x27;gt1l&#x27;, ..., &#x27;gt3r&#x27;, &#x27;gt3r&#x27;, &#x27;gt3r&#x27;], dtype=object)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>68.08 68.08 68.08 ... 65.73 65.73</div><input id='attrs-e11fd4fe-784b-43d1-93c9-0a0ae03de758' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e11fd4fe-784b-43d1-93c9-0a0ae03de758' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a759ac9b-4336-47f2-9dc1-8f8442dce315' class='xr-var-data-in' type='checkbox'><label for='data-a759ac9b-4336-47f2-9dc1-8f8442dce315' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([68.07999907, 68.07982081, 68.07964258, ..., 65.73042956,\n",
       "       65.73025116, 65.73007276])</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>lon</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-47.46 -47.46 ... -49.08 -49.08</div><input id='attrs-40a8eb84-7dda-40bb-b7d2-a56b9bda21e5' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-40a8eb84-7dda-40bb-b7d2-a56b9bda21e5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-45268ca6-998e-4caf-9e38-0e4bbcef91fe' class='xr-var-data-in' type='checkbox'><label for='data-45268ca6-998e-4caf-9e38-0e4bbcef91fe' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([-47.45594147, -47.45599716, -47.45605314, ..., -49.07509074,\n",
       "       -49.07513916, -49.07518767])</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>h_li</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>1681.1671 1681.0332 ... 1479.2249</div><input id='attrs-b2f867a8-fbd5-4743-b28e-c9b32ffdad94' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-b2f867a8-fbd5-4743-b28e-c9b32ffdad94' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-3ae1f53a-16f8-41ab-8a7e-5aea9fe13947' class='xr-var-data-in' type='checkbox'><label for='data-3ae1f53a-16f8-41ab-8a7e-5aea9fe13947' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([1681.1671, 1681.0332, 1680.8826, ..., 1479.2585, 1479.196 ,\n",
       "       1479.2249], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>s_li</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.008938037 ... 0.042509172</div><input id='attrs-88672184-feff-474c-bbfc-da473bbc67b3' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-88672184-feff-474c-bbfc-da473bbc67b3' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-c5b31a4a-314f-4837-b08a-82f2a149528d' class='xr-var-data-in' type='checkbox'><label for='data-c5b31a4a-314f-4837-b08a-82f2a149528d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0.00893804, 0.01263031, 0.01189887, ..., 0.03404627, 0.03771126,\n",
       "       0.04250917], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>q_flag</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int8</div><div class='xr-var-preview xr-preview'>0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0</div><input id='attrs-4df70eb3-fd6f-423f-b775-9f866576db85' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-4df70eb3-fd6f-423f-b775-9f866576db85' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4f28fb94-754f-4cd7-9134-522744a7bccb' class='xr-var-data-in' type='checkbox'><label for='data-4f28fb94-754f-4cd7-9134-522744a7bccb' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0, 0, 0, ..., 0, 0, 0], dtype=int8)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>s_fg</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int8</div><div class='xr-var-preview xr-preview'>0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0</div><input id='attrs-261b17b5-2095-42a6-b5db-9cd6f59ffed5' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-261b17b5-2095-42a6-b5db-9cd6f59ffed5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-cb3d0737-97b8-4a1f-ab63-a666d952f5e2' class='xr-var-data-in' type='checkbox'><label for='data-cb3d0737-97b8-4a1f-ab63-a666d952f5e2' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0, 0, 0, ..., 0, 0, 0], dtype=int8)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>snr</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0</div><input id='attrs-c6cfc817-414c-429b-9bd0-529659d07a05' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-c6cfc817-414c-429b-9bd0-529659d07a05' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-31df586f-d1d5-4013-9f1c-70dd81ec8a87' class='xr-var-data-in' type='checkbox'><label for='data-31df586f-d1d5-4013-9f1c-70dd81ec8a87' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0., 0., 0., ..., 0., 0., 0.], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>h_rb</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.11863171 ... 0.19301407</div><input id='attrs-359df272-2e38-488b-8320-7cfe78aa2378' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-359df272-2e38-488b-8320-7cfe78aa2378' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-48d94985-ecdb-437f-811d-80414cfd3d7b' class='xr-var-data-in' type='checkbox'><label for='data-48d94985-ecdb-437f-811d-80414cfd3d7b' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([0.11863171, 0.13709156, 0.124785  , ..., 0.18269826, 0.20785435,\n",
       "       0.19301407], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>dh_fit_dx</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>-0.006507039 ... -0.0005083084</div><input id='attrs-e497db4f-6d82-4bbe-80fb-a07ce5ded8ad' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-e497db4f-6d82-4bbe-80fb-a07ce5ded8ad' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a5fde9ee-0af0-4ddc-9f94-e45adc1b31ae' class='xr-var-data-in' type='checkbox'><label for='data-a5fde9ee-0af0-4ddc-9f94-e45adc1b31ae' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([-0.00650704, -0.00982141, -0.00499424, ..., -0.01170564,\n",
       "       -0.0007925 , -0.00050831], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>f_sn</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>3.0 3.0 3.0 3.0 ... 3.0 3.0 3.0 3.0</div><input id='attrs-7a27834b-76b9-4c09-9b9c-fbe37bbb06f8' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-7a27834b-76b9-4c09-9b9c-fbe37bbb06f8' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-8712429a-1395-421c-9a36-c99037da33dc' class='xr-var-data-in' type='checkbox'><label for='data-8712429a-1395-421c-9a36-c99037da33dc' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([3., 3., 3., ..., 3., 3., 3.], dtype=float32)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>Integer_Cloud_Mask</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int8</div><div class='xr-var-preview xr-preview'>3 3 3 3 3 3 3 3 ... 3 3 3 3 3 3 3 3</div><input id='attrs-2c01dca5-5192-4f27-9728-4f293fffb974' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-2c01dca5-5192-4f27-9728-4f293fffb974' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7e1d9d00-8dc1-4e7b-93dd-b89eb6148a5e' class='xr-var-data-in' type='checkbox'><label for='data-7e1d9d00-8dc1-4e7b-93dd-b89eb6148a5e' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([3, 3, 3, ..., 3, 3, 3], dtype=int8)</pre></li><li class='xr-var-item'><div class='xr-var-name'><span>idx</span></div><div class='xr-var-dims'>(index)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>10024279 10024279 ... 9202093</div><input id='attrs-072eb734-fe99-4c8f-a978-4f750781cd9c' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-072eb734-fe99-4c8f-a978-4f750781cd9c' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-a1e6b6b7-1445-4b78-827d-5c499ab18edc' class='xr-var-data-in' type='checkbox'><label for='data-a1e6b6b7-1445-4b78-827d-5c499ab18edc' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><pre class='xr-var-data'>array([10024279, 10024279, 10024279, ...,  9202093,  9202093,  9202093])</pre></li></ul></div></li><li class='xr-section-item'><input id='section-f252b724-9178-451b-a1c7-94481f749eca' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-f252b724-9178-451b-a1c7-94481f749eca' class='xr-section-summary'  title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.Dataset>\n",
       "Dimensions:             (index: 252416)\n",
       "Coordinates:\n",
       "  * index               (index) int64 0 1 2 3 4 ... 13174 13175 13176 13177\n",
       "Data variables:\n",
       "    ground_track        (index) object 'gt1l' 'gt1l' 'gt1l' ... 'gt3r' 'gt3r'\n",
       "    lat                 (index) float64 68.08 68.08 68.08 ... 65.73 65.73 65.73\n",
       "    lon                 (index) float64 -47.46 -47.46 -47.46 ... -49.08 -49.08\n",
       "    h_li                (index) float32 1681.1671 1681.0332 ... 1479.2249\n",
       "    s_li                (index) float32 0.008938037 0.012630311 ... 0.042509172\n",
       "    q_flag              (index) int8 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0\n",
       "    s_fg                (index) int8 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0\n",
       "    snr                 (index) float32 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0\n",
       "    h_rb                (index) float32 0.11863171 0.13709156 ... 0.19301407\n",
       "    dh_fit_dx           (index) float32 -0.006507039 ... -0.0005083084\n",
       "    f_sn                (index) float32 3.0 3.0 3.0 3.0 3.0 ... 3.0 3.0 3.0 3.0\n",
       "    Integer_Cloud_Mask  (index) int8 3 3 3 3 3 3 3 3 3 3 ... 3 3 3 3 3 3 3 3 3 3\n",
       "    idx                 (index) int64 10024279 10024279 ... 9202093 9202093"
      ]
     },
     "execution_count": 110,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xray"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ATL03Retrieval.ipynb                                     README.md\n",
      "ATL06Retrieval_xray.ipynb                                \u001b[0m\u001b[01;34m__pycache__\u001b[0m/\n",
      "CLDMSK_L2_VIIRS_SNPP.A2014195.1442.001.2019071103127.nc  \u001b[01;34mdownload\u001b[0m/\n",
      "CloudMask.ipynb                                          utils.py\n",
      "LICENSE\n"
     ]
    }
   ],
   "source": [
    "ls"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
